package com.future.doc.util;

import java.io.IOException;
import java.io.InputStream;

/**
 * 资源访问
 *
 * @author shiyong
 * 2020/5/16 17:10
 */
public class Resources {

    /**
     * 将文件以流的形式加载到内存中
     *
     * @param filePath 文件路径
     * @return java.io.InputStream
     * @author shiyong
     * 2020/5/16 17:14
    */
    public static InputStream getResourceAsStream(String filePath) throws IOException {
        InputStream in = Resources.class.getResourceAsStream(filePath);

        if (in == null) {
            throw new IOException("加载文件失败，filePath=" + filePath);
        }

        return in;
    }

}
